package homework.day01;

import java.util.Scanner;

public class Demo {
    public static void main(String[] args) {
        String regex1="[0-9]+";
        String regex2="[0-9a-zA-z]{3,15}";
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入用户名");
        String user=scanner.nextLine();


            if (user.matches(regex2)){
                System.out.println("请输入年龄");
                String age=scanner.nextLine();
                int age2=Integer.parseInt(age);
                if (age.matches(regex1)&&age2>=1&&age2<=100){
                    System.out.print(" 正确");
                }else {
                    System.out.println("年龄有误");
                }
            }else {
                System.out.println("用户名有误");
            }

    }
}
